﻿using System.ComponentModel.DataAnnotations.Schema;

namespace Application.Entities
{
    [Table("job_distributedlock")]
    //[Index(nameof(Resource), IsUnique = true)]
    public class DistributedLock
    {
        //public DistributedLock(Resource resource)
        //{
        //    Resource = resource;
        //}
        public int Id { get; set; }
        public DateTime UpdateTime { get; set; } = DateTime.Now;
        //public Resource Resource { get; set; }
        //public bool IsLocked { get; set; } = false;
        public bool IsLocked { get; set; }
    }
    [Table("job_distributedlocks")]
    public class DistributedLocks
    {
        public int Id { get; set; }
        public DateTime AcquiredAt { get; set; }
        //public bool IsLocked { get; set; } = false;
    }

    public enum Resource
    {
        OperationQueueJob = 1,
        AssignJob = 2,
        CleanupLog = 3,
        Notice = 4
    }
}
